﻿namespace = culture_tradition_events

##################################################
# #Sparring
# 0001 - 0010	Sparring with [Character]
#
# #HoF Requests
# 0091 - 0100	HoF requests you stamp out a CulTrad that your faith disbars
#
# #Mendicant Mystics
# 0101 - 0110	A mendicant mystic offers to teach your court's children for coin.
# 0111 - 0120	A mendicant mystic seeks to teach you a lesson about HighGodName.
# 0121 - 0130	A mendicant wishes to join your court.
# 0131 - 0140	A mendicant is repulsed by your sins, and invokes the wrath of HighGodName against you.
# 0141 - 0150	A mendicant of your culture, but not your faith, offers tutelage if you'll convert.
##################################################










##################################################
# SPARRING

culture_tradition_events.0001 = {
	type = character_event
	hidden = yes

	immediate = {
		trigger_event = { id = culture_tradition_events.0002 days = 1 }
	}
}

scripted_effect add_sparring_modifier = {
	random_list = {
		1 = {
			trigger = {
				NOT = {
					has_character_modifier = sparring_honed_skills_modifier
				}
			}
			
			add_character_modifier = {
				modifier = sparring_honed_skills_modifier
				years = 10
			}
			
			modifier = {
				add = 1
				this = scope:sc_victor
			}
		}
		1 = {
			trigger = {
				NOT = {
					has_character_modifier = sparring_full_of_confidence_modifier
				}
			}
			
			add_character_modifier = {
				modifier = sparring_full_of_confidence_modifier
				years = 10
			}
			
			modifier = {
				add = 1
				this = scope:sc_victor
			}
		}
		1 = {
			trigger = {
				NOT = {
					has_character_modifier = sparring_chivalric_motivation_modifier
				}
			}
			
			add_character_modifier = {
				modifier = sparring_chivalric_motivation_modifier
				years = 10
			}
			
			modifier = {
				add = 1
				this = scope:sc_victor
			}
		}
		1 = {
			trigger = {
				NOT = {
					has_character_modifier = sparring_valiant_knight_modifier
				}
			}
			
			add_character_modifier = {
				modifier = sparring_valiant_knight_modifier
				years = 10
			}
			
			modifier = {
				add = 1
				this = scope:sc_victor
			}
		}
		1 = {
			trigger = {
				NOT = {
					has_character_modifier = sparring_noble_defender_modifier
				}
			}
			
			add_character_modifier = {
				modifier = sparring_noble_defender_modifier
				years = 10
			}
			
			modifier = {
				add = 1
				this = scope:sc_victor
			}
		}
		1 = {
			trigger = {
				NOT = {
					has_character_modifier = sparring_delusions_of_superiority_modifier
				}
			}
			
			add_character_modifier = {
				modifier = sparring_delusions_of_superiority_modifier
				years = 10
			}
			
			modifier = {
				add = 1
				this = scope:sc_victor
			}
			
			modifier = {
				add = 1
				has_trait = arrogant
			}
		}
		1 = {
			trigger = {
				NOT = {
					has_character_modifier = sparring_leader_of_knights_modifier
				}
			}
			
			add_character_modifier = {
				modifier = sparring_leader_of_knights_modifier
				years = 10
			}
			
			modifier = {
				add = 1
				this = scope:sc_victor
			}
		}
		1 = {
			trigger = {
				NOT = {
					has_character_modifier = sparring_sprained_ankle_modifier
				}
			}
			
			add_character_modifier = {
				modifier = sparring_sprained_ankle_modifier
				years = 10
			}
			
			modifier = {
				add = 1
				this = scope:sc_victor
			}
			
			modifier = {
				add = 1
				NOT = {
					this = scope:sc_victor
				}
			}
		}
	}
}

# Sparring over
culture_tradition_events.0002 = {
	type = character_event
	window = duel_event
	title = culture_tradition_events.0002.t
	desc = {
		desc = culture_tradition_events.0002.desc
		
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:actor = scope:sc_victor
					NOR = {
						has_character_modifier = sparring_sprained_ankle_modifier
						has_character_modifier = sparring_delusions_of_superiority_modifier
					}
				}
				desc = culture_tradition_events.0002.desc_actor_victor_good
			}
			triggered_desc = {
				trigger = {
					scope:actor = scope:sc_victor
					OR = {
						has_character_modifier = sparring_sprained_ankle_modifier
						has_character_modifier = sparring_delusions_of_superiority_modifier
					}
				}
				desc = culture_tradition_events.0002.desc_actor_victor_bad
			}
			triggered_desc = {
				trigger = {
					scope:recipient = scope:sc_victor
					NOR = {
						has_character_modifier = sparring_sprained_ankle_modifier
						has_character_modifier = sparring_delusions_of_superiority_modifier
					}
				}
				desc = culture_tradition_events.0002.desc_recipient_victor_good
			}
			triggered_desc = {
				trigger = {
					scope:recipient = scope:sc_victor
					OR = {
						has_character_modifier = sparring_sprained_ankle_modifier
						has_character_modifier = sparring_delusions_of_superiority_modifier
					}
				}
				desc = culture_tradition_events.0002.desc_recipient_victor_bad
			}
		}
	}
	theme = war
	left_portrait = {
		character = scope:actor
		animation = throne_room_applaud_1
	}
	right_portrait = {
		character = scope:recipient
		animation = throne_room_applaud_1
	}
	
	trigger = {
		
	}

	immediate = {
		scope:actor = {
			add_sparring_modifier = yes
			if = {
				limit = {
					has_trait = tourney_participant
				}
				add_trait_xp = {
					trait = tourney_participant
					track = foot
					value = tournament_hastiludes_xp_gain_minor_value
				}
			}
		}
		scope:recipient = {
			add_sparring_modifier = yes

			if = {
				limit = {
					has_trait = tourney_participant
				}
				add_trait_xp = {
					trait = tourney_participant
					track = foot
					value = tournament_hastiludes_xp_gain_minor_value
				}
			}
		}
	}

	option = {
		name = culture_tradition_events.0002.a
		
		trigger = {
			this = scope:sc_victor
		}

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = culture_tradition_events.0002.b

		trigger = {
			NOT = {
				this = scope:sc_victor
			}
		}
		
		ai_chance = {
			base = 100
		}
	}
}










culture_tradition_events.0099 = {
	scope = culture
	hidden = yes
	
	immediate = {
		if = {
			limit = {
				exists = culture_head
			}
			culture_head = {
				trigger_event = { id = culture_tradition_events.0100 days = 1 }
			}
		}
	}
}

# Head of Faith asks you to remove a tradition you shouldn't have
culture_tradition_events.0100 = {
	type = character_event
	title = culture_tradition_events.0100.t
	desc = {
		desc = culture_tradition_events.0100.desc
		
		first_valid = {
			triggered_desc = { #Only limits to one spouse
				trigger = {
					culture = {
						has_cultural_tradition = tradition_monogamous
					}
				}
				desc = culture_tradition_events.0100.tradition_monogamous
			}
			triggered_desc = { #Only limits to several spouses
				trigger = {
					culture = {
						has_cultural_tradition = tradition_polygamous
					}
				}
				desc = {
					first_valid = {
						triggered_desc = { #The faith accepts concubinage
							trigger = {
								faith = {
									has_doctrine_parameter = allows_polygamy
									has_doctrine_parameter = allows_concubinage
								}
							}
							desc = culture_tradition_events.0100.tradition_polygamous_needs_concubines
						}
						triggered_desc = { #The faith does not accept concubinage
							desc = culture_tradition_events.0100.tradition_polygamous
						}
					}
				}
			}
			triggered_desc = { #Only limits to concubines
				trigger = {
					culture = {
						has_cultural_tradition = tradition_concubines
					}
				}
				desc = {
					first_valid = {
						triggered_desc = { #The faith accepts polygamy
							trigger = {
								faith = {
									has_doctrine_parameter = allows_polygamy
									has_doctrine_parameter = allows_concubinage
								}
							}
							desc = culture_tradition_events.0100.tradition_concubines_needs_polygamy
						}
						triggered_desc = { #The faith does not accept concubinage
							desc = culture_tradition_events.0100.tradition_concubines
						}
					}
				}
			}
			triggered_desc = { #Harem tradition
				desc = culture_tradition_events.0100.tradition_harem
			}
		}
		desc = culture_tradition_events.0100.end
	}
	theme = faith
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:head_of_faith
		animation = dismissal
	}
	
	trigger = {
		culture.culture_head = root
		exists = faith.religious_head
		faith.religious_head.ai_zeal > 0
		faith.religious_head = { is_ai = yes }
		NOR = {
			faith.religious_head = root
			faith.religious_head.culture = root.culture
			culture = {
				has_variable = recently_asked_to_remove_marriage_tradition
			}
		}
		OR = {
			AND = { #Only Polygamy allowed
				faith = {
					has_doctrine_parameter = allows_polygamy
					NOT = {
						has_doctrine_parameter = allows_concubinage
					}
				}
				culture = {
					OR = {
						has_cultural_tradition = tradition_monogamous
						has_cultural_parameter = allows_concubinage
					}
				}
			}
			AND = { #Only Monogamy allowed
				faith = {
					has_doctrine = doctrine_monogamy
					NOT = {
						has_doctrine_parameter = allows_concubinage
					}
				}
				culture = {
					OR = {
						has_cultural_parameter = allows_polygamy
						has_cultural_parameter = allows_concubinage
					}
				}
			}
			AND = { #Only concubinage allowed
				faith = {
					has_doctrine_parameter = allows_concubinage
					NOT = {
						has_doctrine_parameter = allows_polygamy
					}
				}
				culture = {
					OR = {
						has_cultural_tradition = tradition_monogamous
						has_cultural_parameter = allows_polygamy
					}
				}
			}
			AND = { #Only combined doctrines allowed
				faith = {
					has_doctrine_parameter = allows_concubinage
					has_doctrine_parameter = allows_polygamy
				}
				culture = {
					OR = {
						NOT = { has_cultural_parameter = allows_polygamy }
						NOT = { has_cultural_parameter = allows_concubinage }
					}
				}
			}
		}
		culture = {
			calc_culture_dominant_religion = { save_temporary_scope_as = dominant_religion }
		}
		faith.religion = scope:dominant_religion
	}

	immediate = {
		faith.religious_head = {
			save_scope_as = head_of_faith
			faith = {
				save_scope_as = faith_scope
			}
		}
		culture = {
			save_scope_as = culture_scope
			set_variable = {
				name = recently_asked_to_remove_marriage_tradition
				days = 18250 # 50 years
			}
		}
	}

	option = {
		name = culture_tradition_events.0100.a
		
		add_piety_level = 1
		
		hidden_effect = {
			culture = {
				if = {
					limit = {
						has_cultural_tradition = tradition_monogamous
					}
					remove_culture_tradition = tradition_monogamous
				}
				else_if = {
					limit = {
						has_cultural_tradition = tradition_polygamous
					}
					remove_culture_tradition = tradition_polygamous
				}
				else_if = {
					limit = {
						has_cultural_tradition = tradition_concubines
					}
					remove_culture_tradition = tradition_concubines
				}
				else = {
					remove_culture_tradition = tradition_harem
				}
			}
		}
		custom_tooltip = remove_marriage_traditions

		ai_chance = {
			base = 75
		}
	}

	option = {
		name = culture_tradition_events.0100.b
		
		add_piety = massive_piety_loss
		
		add_piety_level = -2
		
		ai_chance = {
			base = 25
		}
	}
}










##################################################
# MENDICANT MYSTICS

scripted_trigger culture_tradition_events_suitable_sub_realm_county_trigger = {
	culture = root.culture
	NOT = { faith = root.faith }
}

scripted_trigger culture_tradition_events_suitable_random_culture_county_trigger = {
	NOT = { faith = root.faith }
}

scripted_trigger cultural_tradition_events_is_valid_mendicant_mystic_trigger = {
	is_available_ai_adult = yes
	# Gotta be an actual guest or some stripe.
	OR = {
		is_pool_guest = yes
		is_pool_character = yes
	}
	# And share root's culture for the CulTrad.
	culture = root.culture
	# Plus, y'know, actually be somewhat mystically-inclined.
	OR = {
		has_trait = devoted
		has_trait = lifestyle_mystic
	}
}

scripted_trigger cultural_tradition_events_is_valid_same_faith_mendicant_mystic_trigger = {
	cultural_tradition_events_is_valid_mendicant_mystic_trigger = yes
	faith = root.faith
}

scripted_trigger cultural_tradition_events_is_valid_diff_faith_mendicant_mystic_trigger = {
	cultural_tradition_events_is_valid_mendicant_mystic_trigger = yes
	NOT = { faith = root.faith }
}

scripted_effect cultural_tradition_events_grab_or_make_mendicant_effect = {
	# Configure our faith.
	save_scope_value_as = {
		name = same_faith
		value = $SAME_FAITH$
	}
	# Try to grab one if a mendicant exists as a guest in the pool at your capital.
	if = {
		limit = {
			any_pool_guest = {
				trigger_if = {
					limit = { scope:same_faith = yes }
					cultural_tradition_events_is_valid_same_faith_mendicant_mystic_trigger = yes
				}
				trigger_else = { cultural_tradition_events_is_valid_diff_faith_mendicant_mystic_trigger = yes }
			}
		}
		random_pool_guest = {
			limit = {
				trigger_if = {
					limit = { scope:same_faith = yes }
					cultural_tradition_events_is_valid_same_faith_mendicant_mystic_trigger = yes
				}
				trigger_else = { cultural_tradition_events_is_valid_diff_faith_mendicant_mystic_trigger = yes }
			}
			save_scope_as = mendicant_mystic
		}
	}
	# Otherwise, if there's one within the capital duchy, grab them.
	else_if = {
		limit = {
			capital_county.duchy = {
				any_in_de_jure_hierarchy = {
					continue = { tier > tier_barony }
					tier = tier_county
					title_province = {
						save_temporary_scope_as = current_province
						any_pool_character = {
							province = scope:current_province
							trigger_if = {
								limit = { scope:same_faith = yes }
								cultural_tradition_events_is_valid_same_faith_mendicant_mystic_trigger = yes
							}
							trigger_else = { cultural_tradition_events_is_valid_diff_faith_mendicant_mystic_trigger = yes }
						}
					}
				}
			}
		}
		capital_county.duchy = {
			random_in_de_jure_hierarchy = {
				continue = { tier > tier_barony }
				limit = {
					tier = tier_county
					title_province = {
						save_temporary_scope_as = current_province
						any_pool_character = {
							province = scope:current_province
							trigger_if = {
								limit = { scope:same_faith = yes }
								cultural_tradition_events_is_valid_same_faith_mendicant_mystic_trigger = yes
							}
							trigger_else = { cultural_tradition_events_is_valid_diff_faith_mendicant_mystic_trigger = yes }
						}
					}
				}
				title_province = {
					save_temporary_scope_as = current_province
					random_pool_character = {
						province = scope:current_province
						limit = {
							trigger_if = {
								limit = { scope:same_faith = yes }
								cultural_tradition_events_is_valid_same_faith_mendicant_mystic_trigger = yes
							}
							trigger_else = { cultural_tradition_events_is_valid_diff_faith_mendicant_mystic_trigger = yes }
						}
						save_scope_as = mendicant_mystic
					}
				}
			}
		}
	}
	# Otherwise, just make one.
	else = {
		create_character = {
			template = mendicant_mystic_character
			location = root.capital_province
			save_scope_as = mendicant_mystic
		}
		hidden_effect = {
			scope:mendicant_mystic = {
				add_random_tiered_trait_xp_effect = {
					TRAIT = lifestyle_mystic
					LEVEL_1 = yes
					LEVEL_3 = yes
				}
			}
		}
		# And since these are disposable characters, we mark 'em for potential death.
		save_scope_value_as = {
			name = kill_mendicant
			value = yes
		}
	}
	# Now that we've got someone, mess around with 'em a little.
	## To suppress errors, we check that they've not just sprung into existence (and thus have this stuff configured).
	hidden_effect = {
		if = {
			limit = {
				NOT = { exists = scope:kill_mendicant }
			}
			scope:mendicant_mystic = {
				# Shift them to your pool if necessary.
				if = {
					limit = {
						NOT = { location = root.capital_province }
					}
					move_to_pool_at = root.capital_province
				}
				# If they don't have the mystic trait yet, give it to 'em.
				if = {
					limit = {
						NOT = { has_trait = lifestyle_mystic }
					}
					add_trait = lifestyle_mystic
				}
				# And if they're not a major heir, devote them to the cause.
				if = {
					limit = {
						NOR = {
							any_claim = {
								exists = this
								tier >= tier_duchy
							}
							any_heir_title = {
								exists = this
								tier >= tier_duchy
							}
						}
					}
					add_trait = devoted
				}
			}
		}
	}
	# Finally, if necessary, switch their faith around.
	## This should only apply to generated mystics, who need to be switched from root's faith.
	if = {
		limit = {
			scope:same_faith = no
			exists = scope:kill_mendicant
		}
		# First, try to nab any appropriate county.
		if = {
			limit = {
				any_sub_realm_county = { culture_tradition_events_suitable_sub_realm_county_trigger = yes }
			}
			random_sub_realm_county = {
				limit = { culture_tradition_events_suitable_sub_realm_county_trigger = yes }
				save_scope_as = appropriate_county
			}
		}
		# Alternatively, try to grab a different faith this culture believes in.
		## Double-scoping to preserve the else_ structure.
		else_if = {
			limit = {
				culture = {
					any_culture_county = { culture_tradition_events_suitable_random_culture_county_trigger = yes }
				}
			}
			culture = {
				random_culture_county = {
					limit = { culture_tradition_events_suitable_random_culture_county_trigger = yes }
					save_scope_as = appropriate_county
				}
			}
		}
		# As a final fallback, try to grab any other faith within root's religion.
		else = {
			religion = {
				random_faith = {
					limit = {
						NOT = { this = root.faith }
					}
					save_scope_as = fallback_faith
				}
			}
		}
		# Lastly, perform a cheeky conversion.
		hidden_effect = {
			scope:mendicant_mystic = {
				if = {
					limit = { exists = scope:appropriate_county }
					set_character_faith = scope:appropriate_county.faith
				}
				else = { set_character_faith = scope:fallback_faith }
			}
		}
	}
}

scripted_effect cultural_tradition_events_boot_mendicant_effect = {
	# Costs a little piety; some added stress loss handled in stress_impact block.
	add_piety = $PIETY_AMOUNT$

	# Stress is different depending on if they're of your faith or not.
	if = {
		limit = { scope:same_faith = yes }
		stress_impact = {
			base = medium_stress_loss
			cynical = miniscule_stress_impact_loss
			shy = miniscule_stress_impact_loss
			gregarious = minor_stress_impact_gain
			zealous = major_stress_impact_gain
		}
	}
	else = {
		stress_impact = {
			base = medium_stress_loss
			cynical = miniscule_stress_impact_loss
			shy = miniscule_stress_impact_loss
			gregarious = minor_stress_impact_gain
		}
	}
}

scripted_effect cultural_tradition_events_disappear_used_mendicant_effect = {
	hidden_effect = {
		scope:mendicant_mystic = {
			if = {
				limit = {
					NOT = { liege = root }
				}
				# Since we do want some of these folks to actually *wander*, we don't just kill them all.
				random_list = {
					# Some mendicants disappear into obscurity...
					100 = {
						trigger = { exists = scope:kill_mendicant }
						death = { death_reason = death_vanished }
					}
					# ... whilst others may go on to greatness.
					100 = { move_to_pool = yes }
				}
			}
		}
	}
}

##################################################
# A Mystic's Mind
# by Ewan Cowhig Croft
# 0101 - 0110
##################################################

scripted_trigger culture_tradition_events_0101_child_available_for_tutoring_trigger = {
	is_adult = no
	is_available = yes
}

scripted_effect culture_tradition_events_0101_add_extra_childhood_education_points_effect = {
	if = {
		limit = {
			exists = var:education_$SKILL$_variable
		}
		change_variable = {
			name = education_$SKILL$_variable
			add = {
				value = 4
				if = {
					limit = { scope:mendicant_mystic.$SKILL$ >= high_skill_rating }
					add = 2
				}
			}
		}
	}
}

scripted_effect culture_tradition_events_0101_educate_them_childrens_effect = {
	custom_tooltip = culture_tradition_events.0101.a.tt
	hidden_effect = {
		every_courtier = {
			limit = { culture_tradition_events_0101_child_available_for_tutoring_trigger = yes }
			# Increase any education they're already somewhat trained in.
			## If scope:mendicant_mystic is skilled in the skill, we give extra.
			culture_tradition_events_0101_add_extra_childhood_education_points_effect = { SKILL = diplomacy }
			culture_tradition_events_0101_add_extra_childhood_education_points_effect = { SKILL = martial }
			culture_tradition_events_0101_add_extra_childhood_education_points_effect = { SKILL = stewardship }
			culture_tradition_events_0101_add_extra_childhood_education_points_effect = { SKILL = intrigue }
			culture_tradition_events_0101_add_extra_childhood_education_points_effect = { SKILL = learning }
		}
	}
}

#	A mendicant mystic offers to teach your court's children for coin.
culture_tradition_events.0101 = {
	type = character_event
	title = culture_tradition_events.0101.t
	desc = culture_tradition_events.0101.desc
	theme = faith
	left_portrait = {
		character = scope:mendicant_mystic
		animation = personality_zealous
	}
	override_background = { reference = feast }

	cooldown = { years = 10 }

	trigger = {
		# Standard checks.
		is_available_at_peace_adult = yes
		is_landed = yes
		culture = { has_cultural_parameter = mendicant_mystics_may_appear }
		# Must have at least one child at court.
		any_courtier = { culture_tradition_events_0101_child_available_for_tutoring_trigger = yes }
	}

	weight_multiplier = {
		base = 1
		
		# Weight up characters that attract mendicants.
		ep1_make_mendicants_likely_modifier = yes
	}

	immediate = {
		# Sort a starting mendicant.
		cultural_tradition_events_grab_or_make_mendicant_effect = { SAME_FAITH = yes }
	}

	# Of course, noble PriestNeuter!
	option = {
		name = culture_tradition_events.0101.a
		trigger = {
			# Have enough cash to hand for it.
			can_make_expensive_purchase_trigger = { PRICE = culture_tradition_events_0101_tutor_surcharge_value }
		}

		# Pay the cost to scope:mendicant_mystic.
		remove_short_term_gold = culture_tradition_events_0101_tutor_surcharge_value
		# Boost the education chances of every child at court.
		culture_tradition_events_0101_educate_them_childrens_effect = yes

		stress_impact = {
			zealous = miniscule_stress_impact_loss
			cynical = minor_stress_impact_gain
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.75
				ai_compassion = 0.25
				ai_greed = -1
			}
		}
	}
	
	# Do you not think you charge a little too much in the name of HighGodName?
	option = {
		name = culture_tradition_events.0101.b

		# Duel scope:mendicant_mystic to bring the price down.
		duel = {
			skill = learning
			target = scope:mendicant_mystic
			# You argue the mystic down.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -40
				}
				desc = culture_tradition_events.0101.b.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = culture_tradition_events.0101.b.tt.success
					left_icon = scope:mendicant_mystic
					remove_short_term_gold = {
						value = culture_tradition_events_0101_tutor_surcharge_value
						multiply = 0.5
						round = yes
					}
					culture_tradition_events_0101_educate_them_childrens_effect = yes
				}
			}
			# The mystic leaves your court in disgust.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -40
				}
				desc = culture_tradition_events.0101.b.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = culture_tradition_events.0101.b.tt.failure
					left_icon = scope:mendicant_mystic
					# Lose a little piety.
					add_piety = minor_piety_loss
				}
			}
		}

		stress_impact = {
			greedy = miniscule_stress_impact_loss
			zealous = minor_stress_impact_gain
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_boldness = 0.5
				ai_compassion = 0.25
				ai_greed = -0.5
			}
		}
	}
	
	# Be gone, beggar, I'm trying to eat my dinner.
	option = {
		name = culture_tradition_events.0101.c

		# Standard get-lost-mendinerd effect.
		cultural_tradition_events_boot_mendicant_effect = { PIETY_AMOUNT = minor_piety_loss }

		# Stress impact handled in the scripted effect.
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -0.25
				ai_sociability = -0.5
				ai_zeal = -1
			}
		}
	}

	# Loose-or-reduce scope:mendicant_mystic.
	after = { cultural_tradition_events_disappear_used_mendicant_effect = yes }
}

##################################################
# A Mystic's Speech
# by Ewan Cowhig Croft
# 0111 - 0120
##################################################

#	A mendicant mystic seeks to teach you a lesson about HighGodName.
culture_tradition_events.0111 = {
	type = character_event
	title = culture_tradition_events.0111.t
	desc = culture_tradition_events.0111.desc
	theme = faith
	left_portrait = {
		character = scope:mendicant_mystic
		animation = personality_zealous
	}
	override_background = { reference = throne_room }

	cooldown = { years = 10 }

	trigger = {
		# Standard checks.
		is_available_at_peace_adult = yes
		is_landed = yes
		culture = { has_cultural_parameter = mendicant_mystics_may_appear }
	}

	weight_multiplier = {
		base = 1
		
		# Weight up characters that attract mendicants.
		ep1_make_mendicants_likely_modifier = yes
	}

	immediate = {
		# Sort a starting mendicant.
		cultural_tradition_events_grab_or_make_mendicant_effect = { SAME_FAITH = yes }
	}

	# Such inspiring words!
	option = {
		name = culture_tradition_events.0111.a

		# Take the free piety.
		add_piety = medium_piety_gain

		stress_impact = {
			zealous = miniscule_stress_impact_loss
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_sociability = 0.5
				ai_vengefulness = -0.25
			}
		}
	}
	
	# You've said your piece, now let me say mine...
	option = {
		name = culture_tradition_events.0111.b

		# Duel them for even more piety.
		duel = {
			skill = learning
			target = scope:mendicant_mystic
			# You win! The mendicant leaves, disgraced.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -40
				}
				desc = culture_tradition_events.0111.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = culture_tradition_events.0111.a.tt.success
					left_icon = scope:mendicant_mystic
					add_piety = major_piety_gain
				}
			}
			# You lose! The mendicant lectures you.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -40
				}
				desc = culture_tradition_events.0111.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad	
					title = culture_tradition_events.0111.a.tt.failure
					left_icon = scope:mendicant_mystic
					add_piety = medium_piety_loss
				}
			}
		}

		stress_impact = {
			stubborn = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_boldness = 0.75
				ai_energy = 0.5
			}
		}
	}
	
	# Who let this vagabond into my home?
	option = {
		name = culture_tradition_events.0111.c

		# Standard get-lost-mendinerd effect.
		cultural_tradition_events_boot_mendicant_effect = { PIETY_AMOUNT = minor_piety_loss }

		# Stress impact handled in the scripted effect.
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -0.25
				ai_sociability = -0.5
				ai_zeal = -1
			}
		}
	}

	# Loose-or-reduce scope:mendicant_mystic.
	after = { cultural_tradition_events_disappear_used_mendicant_effect = yes }
}

##################################################
# A Mystic's Service
# by Ewan Cowhig Croft
# 0121 - 0130
##################################################

scripted_effect culture_tradition_events_0121_gain_free_mystic_effect = {
	add_courtier = scope:mendicant_mystic
	reverse_add_opinion = {
		target = scope:mendicant_mystic
		modifier = respect_opinion
		opinion = 75
	}
}

#	A mendicant wishes to join your court.
culture_tradition_events.0121 = {
	type = character_event
	title = culture_tradition_events.0121.t
	desc = culture_tradition_events.0121.desc
	theme = faith
	left_portrait = {
		character = scope:mendicant_mystic
		animation = personality_zealous
	}
	override_background = { reference = throne_room }

	cooldown = { years = 10 }

	trigger = {
		# Standard checks.
		is_available_at_peace_adult = yes
		is_landed = yes
		culture = { has_cultural_parameter = mendicant_mystics_may_appear }
	}

	weight_multiplier = {
		base = 1
		
		# Weight up characters that attract mendicants.
		ep1_make_mendicants_likely_modifier = yes
	}

	immediate = {
		# Sort a starting mendicant.
		cultural_tradition_events_grab_or_make_mendicant_effect = { SAME_FAITH = yes }
	}

	# I can certainly use a WomanMan of your talents...
	option = {
		name = culture_tradition_events.0121.a

		# Get scope:mendicant_mystic as a courtier.
		culture_tradition_events_0121_gain_free_mystic_effect = yes

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 0.75
				ai_compassion = 0.5
			}
		}
	}
	
	# What a Court Priest you would make!
	option = {
		name = culture_tradition_events.0121.b
		trigger = {
			# Just double check we haven't got a mystic who can't be a Court Priest.
			scope:mendicant_mystic = {
				can_be_court_chaplain_trigger = { COURT_OWNER = root }
			}
			# If a Court Priest exists, make sure they can be sacked.
			OR = {
				NOT = { exists = cp:councillor_court_chaplain}
				# No strong hooks, recent hires, or doctrinal bans (since they're hard-locked) to be shunted out.
				cp:councillor_court_chaplain = {
					can_be_fired_from_council_trigger = { COURT_OWNER = root }
				}
			}
		}

		# Replace your Court Priest with scope:mendicant_mystic.
		culture_tradition_events_0121_gain_free_mystic_effect = yes
		if = {
			limit = { exists = cp:councillor_court_chaplain }
			fire_councillor = cp:councillor_court_chaplain
		}
		assign_councillor_type = {
			type = councillor_court_chaplain
			target = scope:mendicant_mystic
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 0.75
				ai_rationality = 0.5
			}
		}
	}
	
	# Looking like that, *smelling* like that, and you want to live here?
	option = {
		name = culture_tradition_events.0121.c
		
		# Standard get-lost-mendinerd effect.
		cultural_tradition_events_boot_mendicant_effect = { PIETY_AMOUNT = minor_piety_loss }

		# Stress impact handled in the scripted effect.
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -0.25
				ai_sociability = -0.5
				ai_zeal = -1
			}
		}
	}

	# Loose-or-reduce scope:mendicant_mystic.
	after = { cultural_tradition_events_disappear_used_mendicant_effect = yes }
}

##################################################
# A Mystic's Wrath
# by Ewan Cowhig Croft
# 0131 - 0140
##################################################

scripted_trigger culture_tradition_events_0131_sinful_personality_trait_trigger = {
	has_trait = $TRAIT$
	faith = { trait_is_sin = $TRAIT$ }
}

#	A mendicant is repulsed by your sins, and invokes the wrath of HighGodName against you.
culture_tradition_events.0131 = {
	type = character_event
	title = culture_tradition_events.0131.t
	desc = culture_tradition_events.0131.desc
	theme = faith
	left_portrait = {
		character = scope:mendicant_mystic
		animation = personality_zealous
	}
	override_background = { reference = throne_room }

	cooldown = { years = 10 }

	trigger = {
		# Standard checks.
		is_available_at_peace_adult = yes
		is_landed = yes
		culture = { has_cultural_parameter = mendicant_mystics_may_appear }
		# You need at least one sin.
		## Since we're looking at personality traits, we don't check just num_sinful_traits, as that'd catch more esoteric stuff that the event isn't prepared for.
		OR = {
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = lustful }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = chaste }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = gluttonous }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = temperate }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = greedy }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = generous }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = lazy }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = diligent }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = wrathful }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = calm }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = patient }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = impatient }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = arrogant }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = humble }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = deceitful }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = honest }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = craven }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = brave }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = shy }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = gregarious }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = ambitious }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = content }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = arbitrary }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = just }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = cynical }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = zealous }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = paranoid }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = trusting }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = compassionate }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = callous }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = sadistic }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = stubborn }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = fickle }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = vengeful }
			culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = forgiving }
		}
	}

	weight_multiplier = {
		base = 1
		
		# Weight up characters that attract mendicants.
		## This is ironically more likely if you have virtuous traits also: you should know better, after all.
		ep1_make_mendicants_likely_modifier = yes
	}

	immediate = {
		# Sort a starting mendicant.
		cultural_tradition_events_grab_or_make_mendicant_effect = { SAME_FAITH = yes }
		# Select a particular sin.
		## Weightings are mostly even, since any sin is good sin, y'know?
		random_list = {
			# lustful
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = lustful }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = lustful }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = chaste }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:lustful
				}
			}
			# chaste
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = chaste }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = chaste }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = lustful }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:chaste
				}
			}
			# gluttonous
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = gluttonous }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = gluttonous }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = temperate }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:gluttonous
				}
			}
			# temperate
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = temperate }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = temperate }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = gluttonous }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:temperate
				}
			}
			# greedy
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = greedy }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = greedy }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = generous }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:greedy
				}
			}
			# generous
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = generous }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = generous }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = greedy }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:generous
				}
			}
			# lazy
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = lazy }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = lazy }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = diligent }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:lazy
				}
			}
			# diligent
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = diligent }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = diligent }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = lazy }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:diligent
				}
			}
			# wrathful
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = wrathful }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = wrathful }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = calm }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:wrathful
				}
			}
			# calm
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = calm }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = calm }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = wrathful }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:calm
				}
			}
			# patient
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = patient }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = patient }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = impatient }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:patient
				}
			}
			# impatient
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = impatient }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = impatient }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = patient }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:impatient
				}
			}
			# arrogant
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = arrogant }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = arrogant }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = humble }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:arrogant
				}
			}
			# humble
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = humble }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = humble }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = arrogant }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:humble
				}
			}
			# deceitful
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = deceitful }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = deceitful }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = honest }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:deceitful
				}
			}
			# honest
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = honest }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = honest }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = deceitful }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:honest
				}
			}
			# craven
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = craven }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = craven }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = brave }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:craven
				}
			}
			# brave
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = brave }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = brave }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = craven }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:brave
				}
			}
			# shy
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = shy }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = shy }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = gregarious }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:shy
				}
			}
			# gregarious
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = gregarious }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = gregarious }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = shy }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:gregarious
				}
			}
			# ambitious
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = ambitious }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = ambitious }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = content }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:ambitious
				}
			}
			# content
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = content }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = content }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = ambitious }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:content
				}
			}
			# arbitrary
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = arbitrary }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = arbitrary }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = just }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:arbitrary
				}
			}
			# just
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = just }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = just }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = arbitrary }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:just
				}
			}
			# cynical
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = cynical }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = cynical }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = zealous }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:cynical
				}
			}
			# zealous
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = zealous }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = zealous }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = cynical }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:zealous
				}
			}
			# paranoid
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = paranoid }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = paranoid }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = trusting }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:paranoid
				}
			}
			# trusting
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = trusting }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = trusting }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = paranoid }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:trusting
				}
			}
			# compassionate
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = compassionate }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = compassionate }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = {
						OR = {
							trait_is_virtue = callous
							trait_is_virtue = sadistic
						}
					}
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:compassionate
				}
			}
			# callous
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = callous }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = callous }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = compassionate }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:callous
				}
			}
			# sadistic
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = sadistic }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = sadistic }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = compassionate }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:sadistic
				}
			}
			# stubborn
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = stubborn }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = stubborn }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = fickle }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:stubborn
				}
			}
			# fickle
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = fickle }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = fickle }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = stubborn }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:fickle
				}
			}
			# vengeful
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = vengeful }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = vengeful }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = forgiving }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:vengeful
				}
			}
			# forgiving
			100 = {
				trigger = {
					culture_tradition_events_0131_sinful_personality_trait_trigger = { TRAIT = forgiving }
				}
				# Remember to weight down any sins that scope:mendicant_mystic suffers from themselves.
				modifier = {
					add = -99
					exists = scope:mendicant_mystic
					scope:mendicant_mystic = { has_trait = forgiving }
				}
				# And weight up any traits where the *opposite* is definitely a virtue.
				modifier = {
					factor = 5
					faith = { trait_is_virtue = vengeful }
				}
				save_scope_value_as = {
					name = sinful_trait
					value = flag:forgiving
				}
			}
		}
	}

	# *My* sins? Let's talk about *you*.
	option = {
		name = culture_tradition_events.0131.a

		# Learning duel scope:mendicant_mystic to try to reverse-uno the piety loss.
		duel = {
			skill = learning
			target = scope:mendicant_mystic
			# Haha, it is *you* who am the sin!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -40
				}
				desc = culture_tradition_events.0131.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = culture_tradition_events.0131.a.tt.success
					left_icon = scope:mendicant_mystic
					add_piety = major_piety_gain
				}
			}
			# ;_;
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -40
				}
				desc = culture_tradition_events.0131.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = culture_tradition_events.0131.a.tt.failure
					left_icon = scope:mendicant_mystic
					add_piety = major_piety_loss
				}
			}
		}

		stress_impact = {
			cynical = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
			zealous = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_energy = -0.5
			}
		}
	}
	
	# Will... will you teach me to be better?
	option = {
		name = culture_tradition_events.0131.b

		# Your randomly-selected sinful trait may be flipped to its inverse.
		random_list = {
			# Sin flips!
			60 = {
				send_interface_toast = {
					type = event_toast_effect_good
					title = culture_tradition_events.0131.b.tt.success
					left_icon = scope:mendicant_mystic
					# Process the sin changing.
					## lustful
					if = {
						limit = { scope:sinful_trait = flag:lustful }
						remove_trait = lustful
						add_trait_force_tooltip = chaste
					}
					## chaste
					if = {
						limit = { scope:sinful_trait = flag:chaste }
						remove_trait = chaste
						add_trait_force_tooltip = lustful
					}
					## gluttonous
					if = {
						limit = { scope:sinful_trait = flag:gluttonous }
						remove_trait = gluttonous
						add_trait_force_tooltip = temperate
					}
					## temperate
					if = {
						limit = { scope:sinful_trait = flag:temperate }
						remove_trait = temperate
						add_trait_force_tooltip = gluttonous
					}
					## greedy
					if = {
						limit = { scope:sinful_trait = flag:greedy }
						remove_trait = greedy
						add_trait_force_tooltip = generous
					}
					## generous
					if = {
						limit = { scope:sinful_trait = flag:generous }
						remove_trait = generous
						add_trait_force_tooltip = greedy
					}
					## lazy
					if = {
						limit = { scope:sinful_trait = flag:lazy }
						remove_trait = lazy
						add_trait_force_tooltip = diligent
					}
					## diligent
					if = {
						limit = { scope:sinful_trait = flag:diligent }
						remove_trait = diligent
						add_trait_force_tooltip = lazy
					}
					## wrathful
					if = {
						limit = { scope:sinful_trait = flag:wrathful }
						remove_trait = wrathful
						add_trait_force_tooltip = calm
					}
					## calm
					if = {
						limit = { scope:sinful_trait = flag:calm }
						remove_trait = calm
						add_trait_force_tooltip = wrathful
					}
					## patient
					if = {
						limit = { scope:sinful_trait = flag:patient }
						remove_trait = patient
						add_trait_force_tooltip = impatient
					}
					## impatient
					if = {
						limit = { scope:sinful_trait = flag:impatient }
						remove_trait = impatient
						add_trait_force_tooltip = patient
					}
					## arrogant
					if = {
						limit = { scope:sinful_trait = flag:arrogant }
						remove_trait = arrogant
						add_trait_force_tooltip = humble
					}
					## humble
					if = {
						limit = { scope:sinful_trait = flag:humble }
						remove_trait = humble
						add_trait_force_tooltip = arrogant
					}
					## deceitful
					if = {
						limit = { scope:sinful_trait = flag:deceitful }
						remove_trait = deceitful
						add_trait_force_tooltip = honest
					}
					## honest
					if = {
						limit = { scope:sinful_trait = flag:honest }
						remove_trait = honest
						add_trait_force_tooltip = deceitful
					}
					## craven
					if = {
						limit = { scope:sinful_trait = flag:craven }
						remove_trait = craven
						add_trait_force_tooltip = brave
					}
					## brave
					if = {
						limit = { scope:sinful_trait = flag:brave }
						remove_trait = brave
						add_trait_force_tooltip = craven
					}
					## shy
					if = {
						limit = { scope:sinful_trait = flag:shy }
						remove_trait = shy
						add_trait_force_tooltip = gregarious
					}
					## gregarious
					if = {
						limit = { scope:sinful_trait = flag:gregarious }
						remove_trait = gregarious
						add_trait_force_tooltip = shy
					}
					## ambitious
					if = {
						limit = { scope:sinful_trait = flag:ambitious }
						remove_trait = ambitious
						add_trait_force_tooltip = content
					}
					## content
					if = {
						limit = { scope:sinful_trait = flag:content }
						remove_trait = content
						add_trait_force_tooltip = ambitious
					}
					## arbitrary
					if = {
						limit = { scope:sinful_trait = flag:arbitrary }
						remove_trait = arbitrary
						add_trait_force_tooltip = just
					}
					## just
					if = {
						limit = { scope:sinful_trait = flag:just }
						remove_trait = just
						add_trait_force_tooltip = arbitrary
					}
					## cynical
					if = {
						limit = { scope:sinful_trait = flag:cynical }
						remove_trait = cynical
						add_trait_force_tooltip = zealous
					}
					## zealous
					if = {
						limit = { scope:sinful_trait = flag:zealous }
						remove_trait = zealous
						add_trait_force_tooltip = cynical
					}
					## paranoid
					if = {
						limit = { scope:sinful_trait = flag:paranoid }
						remove_trait = paranoid
						add_trait_force_tooltip = trusting
					}
					## trusting
					if = {
						limit = { scope:sinful_trait = flag:trusting }
						remove_trait = trusting
						add_trait_force_tooltip = paranoid
					}
					## compassionate
					if = {
						limit = { scope:sinful_trait = flag:compassionate }
						remove_trait = compassionate
						# If callous is virtuous, go for that.
						if = {
							limit = {
								faith = { trait_is_virtue = callous }
							}
							add_trait_force_tooltip = callous
						}
						# Otherwise, if sadistic is virtuous, we'll have that instead.
						else_if = {
							limit = {
								faith = { trait_is_virtue = sadistic }
							}
							add_trait_force_tooltip = sadistic
						}
						# Else just a 50:50 shot for callous or sadistic.
						else = {
							random_list = {
								50 = { add_trait_force_tooltip = callous }
								50 = { add_trait_force_tooltip = sadistic }
							}
						}
					}
					## callous
					if = {
						limit = { scope:sinful_trait = flag:callous }
						remove_trait = callous
						add_trait_force_tooltip = compassionate
					}
					## sadistic
					if = {
						limit = { scope:sinful_trait = flag:sadistic }
						remove_trait = sadistic
						add_trait_force_tooltip = compassionate
					}
					## stubborn
					if = {
						limit = { scope:sinful_trait = flag:stubborn }
						remove_trait = stubborn
						add_trait_force_tooltip = fickle
					}
					## fickle
					if = {
						limit = { scope:sinful_trait = flag:fickle }
						remove_trait = fickle
						add_trait_force_tooltip = stubborn
					}
					## vengeful
					if = {
						limit = { scope:sinful_trait = flag:vengeful }
						remove_trait = vengeful
						add_trait_force_tooltip = forgiving
					}
					## forgiving
					if = {
						limit = { scope:sinful_trait = flag:forgiving }
						remove_trait = forgiving
						add_trait_force_tooltip = vengeful
					}
				}
			}
			# :( Sin no-flip.
			40 = {
				send_interface_toast = {
					type = event_toast_effect_bad	
					title = culture_tradition_events.0131.b.tt.failure
					left_icon = scope:mendicant_mystic
					# Double whammy for playing with your own brain.
					add_stress = massive_stress_gain
				}
			}
		}

		# Some extra stress gain handled in the stress_impact block.

		stress_impact = {
			base = massive_stress_gain
			humble = miniscule_stress_impact_loss
			fickle = miniscule_stress_impact_loss
			cynical = minor_stress_impact_gain
			arrogant = major_stress_impact_gain
			stubborn = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 0.5
				ai_vengefulness = -0.5
			}
		}
	}
	
	# Guards! Throw this lunatic into the nearest cess pit!
	option = {
		name = culture_tradition_events.0131.c

		# Standard get-lost-mendinerd effect.
		cultural_tradition_events_boot_mendicant_effect = { PIETY_AMOUNT = major_piety_loss }

		# Stress impact handled in the scripted effect.
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -0.25
				ai_sociability = -0.5
				ai_zeal = -1
			}
		}
	}

	# Loose-or-reduce scope:mendicant_mystic.
	after = { cultural_tradition_events_disappear_used_mendicant_effect = yes }
}

##################################################
# A Mystic's Bargain
# by Ewan Cowhig Croft
# 0141 - 0150
##################################################

#	A mendicant of your culture, but not your faith, offers tutelage if you'll convert.
culture_tradition_events.0141 = {
	type = character_event
	title = culture_tradition_events.0141.t
	desc = culture_tradition_events.0141.desc
	theme = faith
	left_portrait = {
		character = scope:mendicant_mystic
		animation = personality_zealous
	}
	override_background = { reference = throne_room }

	cooldown = { years = 30 }

	trigger = {
		# Standard checks.
		is_available_at_peace_adult = yes
		is_landed = yes
		culture = { has_cultural_parameter = mendicant_mystics_may_appear }
		# For edge-cases, check that the religion incorporates more than one faith.
		religion = {
			any_faith = { count >= 2 }
		}
		# Must have at least one same-culture diff-faith county in your sub-realm, or else a good culture fallback somewhere else.
		OR = {
			any_sub_realm_county = { culture_tradition_events_suitable_sub_realm_county_trigger = yes }
			culture = {
				any_culture_county = { culture_tradition_events_suitable_random_culture_county_trigger = yes }
			}
		}
	}

	weight_multiplier = {
		base = 1
		
		# Weight up characters that attract mendicants.
		ep1_make_mendicants_likely_modifier = yes
	}

	immediate = {
		# Sort a starting mendicant.
		cultural_tradition_events_grab_or_make_mendicant_effect = { SAME_FAITH = no }
	}

	# I find your words compelling, PriestNeuter.
	option = {
		name = culture_tradition_events.0141.a

		# You convert to scope:mendicant_mystic's faith.
		set_character_faith_with_conversion = scope:mendicant_mystic.faith
		# You lose a level of piety.
		add_piety_level = -1
		# Buuuuut you do gain a chunk of spending piety, sans experience.
		add_piety_no_experience = major_piety_gain

		stress_impact = {
			greedy = miniscule_stress_impact_loss
			lustful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.75
				ai_energy = 0.5
				ai_zeal = -1
			}
		}
	}
	
	# Allow me to elucidate the merits of GetFaith.GetName...
	option = {
		name = culture_tradition_events.0141.b

		# Learning duel to try and convince scope:mendicant_mystic that your faith is the righteous one.
		duel = {
			skill = learning
			target = scope:mendicant_mystic
			# If you win, you gain piety *and* the mystic, who converts.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -40
				}
				desc = culture_tradition_events.0141.b.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = culture_tradition_events.0141.b.tt.success
					left_icon = scope:mendicant_mystic
					scope:mendicant_mystic = { set_character_faith = root.faith }
					culture_tradition_events_0121_gain_free_mystic_effect = yes
				}
			}
			# If you lose, toss some prestige down the drain.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -40
				}
				desc = culture_tradition_events.0141.b.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad	
					title = culture_tradition_events.0141.b.tt.failure
					left_icon = scope:mendicant_mystic
					add_prestige = medium_prestige_loss
				}
			}
		}

		stress_impact = {
			zealous = miniscule_stress_impact_loss
			cynical = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 0.75
				ai_zeal = 0.5
				ai_energy = 0.5
				ai_vengefulness = -0.25
			}
		}
	}
	
	# Your HighGodName! How many levies has HighGodSheHe got?
	option = {
		name = culture_tradition_events.0141.c

		# Standard get-lost-mendinerd effect.
		cultural_tradition_events_boot_mendicant_effect = { PIETY_AMOUNT = minor_piety_gain }

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_energy = -0.25
				ai_sociability = -0.5
			}
		}
	}

	# Loose-or-reduce scope:mendicant_mystic.
	after = { cultural_tradition_events_disappear_used_mendicant_effect = yes }
}

##################################################
# A question of Loyalty
##################################################

#	A fair ruler inspires a vassal to become loyal
culture_tradition_events.2000 = {
	type = character_event
	title = culture_tradition_events.2000.t
	desc = culture_tradition_events.2000.desc

	theme = court
	left_portrait = {
		character = root
		animation = throne_room_writer
	}
	right_portrait = {
		character = scope:inspiring_vassal
		animation = admiration
	}
	lower_right_portrait = liege

	override_background = { reference = throne_room }

	cooldown = { years = 50 } #Not something to be considered often

	trigger = {
		# Standard checks.
		is_available_at_peace_adult = yes
		is_landed = yes
		is_independent_ruler = no
		NOR = {
			has_trait = loyal
			has_trait = disloyal
		}
		liege = {
			tyranny < 25 #Only something for fair rulers
			dread < 25 #Dread does not inspire loyalty even if it inspires obedience
		}
		#I like my liege
		opinion = {
			target = liege
			value > 50
		}
		any_vassal = { #I must have vassals of my own
			count >= 1
		}
		#I am a friend of my liege or my culture values loyalty more and I am not an enemy of my liege
		OR = {
			liege = { has_relation_friend = root }
			liege = { has_relation_best_friend = root }
			AND = {
				culture = {
					has_cultural_parameter = loyal_trait_more_common
				}
				liege = {
					NOR = {
						has_relation_nemesis = root
						has_relation_rival = root
					}
				}
			}
		}
	}

	immediate = {
		random_vassal = {
			save_scope_as = inspiring_vassal
		}
	}

	weight_multiplier = {
		base = 1
	}

	# 
	option = {
		name = culture_tradition_events.2000.a
		add_trait = loyal
		pay_short_term_gold = {
			target = scope:inspiring_vassal
			gold = scope:inspiring_vassal.medium_gold_value
		}
		scope:inspiring_vassal = {
			add_opinion = {
				target = root
				modifier = favored_vassal_opinion
				opinion = 25
			}
		}
		stress_impact = {
			schemer = medium_stress_impact_gain
			deceitful = medium_stress_impact_gain
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 0.75
				ai_compassion = 0.5
				ai_boldness = -0.25
				ai_rationality = -0.25
				ai_vengefulness = -1
			}
		}
	}
	
	# 
	option = {
		name = culture_tradition_events.2000.b
		add_prestige = medium_prestige_value
		scope:inspiring_vassal = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -25
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
				ai_rationality = 0.5
				ai_boldness = 0.5
				ai_compassion = -0.5
			}
		}
	}
}

#	An opportunity arises to enrich oneself at the cost of others
culture_tradition_events.2001 = {
	type = character_event
	title = culture_tradition_events.2001.t
	desc = culture_tradition_events.2001.desc

	theme = intrigue
	left_portrait = {
		character = root
		animation = lantern
	}
	lower_left_portrait = scope:targeted_vassal
	lower_right_portrait = liege

	override_background = { reference = corridor_night }

	cooldown = { years = 50 } #Not something to be considered often

	trigger = {
		# Standard checks.
		is_available_at_peace_adult = yes
		is_landed = yes
		is_independent_ruler = no
		NOR = {
			has_trait = loyal
			has_trait = disloyal
		}
		#I dislike my liege
		opinion = {
			target = liege
			value < 50
		}
		any_vassal = { #I must have vassals of my own
			count >= 1
		}
		#I am an enemy of my liege or my culture values loyalty less and I am not a friend of my liege
		OR = {
			liege = { has_relation_rival = root }
			liege = { has_relation_nemesis = root }
			AND = {
				culture = {
					has_cultural_parameter = disloyal_trait_more_common
				}
				liege = {
					NOR = {
						has_relation_best_friend = root
						has_relation_friend = root
					}
				}
			}
		}
		any_vassal = {
			save_temporary_scope_as = vassal
			NOT = {
				root = {
					has_hook_of_type = {
						target = scope:vassal
						type = favor_hook
					}
				}
			}
		}
	}

	immediate = {
		random_vassal = {
			limit = {
				save_temporary_scope_as = vassal
				NOT = {
					root = {
						has_hook_of_type = {
							target = scope:vassal
							type = favor_hook
						}
					}
				}
			}
			save_scope_as = targeted_vassal
		}
	}

	weight_multiplier = {
		base = 1
	}

	#Get a hook
	option = {
		name = culture_tradition_events.2001.a
		#Fail-safe
		trigger = {
			NOT = {
				root = {
					has_hook_of_type = {
						target = scope:targeted_vassal
						type = favor_hook
					}
				}
			}
		}
		add_trait = disloyal
		add_hook = {
			target = scope:targeted_vassal
			type = favor_hook
        }
		scope:targeted_vassal = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -25
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
				ai_rationality = 0.5
				ai_boldness = 0.5
				ai_compassion = -0.5
			}
		}
	}
	
	#Get some prestige
	option = {
		name = culture_tradition_events.2001.b
		add_prestige = medium_prestige_value
		scope:targeted_vassal = {
			add_opinion = {
				target = root
				modifier = favored_vassal_opinion
				opinion = 25
			}
		}
		stress_impact = {
			schemer = medium_stress_impact_gain
			deceitful = medium_stress_impact_gain
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 0.75
				ai_compassion = 0.5
				ai_boldness = -0.25
				ai_rationality = -0.25
				ai_vengefulness = -1
			}
		}
	}
}

##################################################
# Storytelling
##################################################

culture_tradition_events.2100 = {
	type = character_event
	title = culture_tradition_events.2100.t
	desc = {
		desc = childhood.7500.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:memory_participant
					OR = {
                        scope:memory_participant = {
                            is_alive = yes
                        }
                        exists = scope:death
                    }
				}
				desc = childhood.7500.participant
			}
			triggered_desc = {
				trigger = {
					exists = scope:memory_participant
					scope:memory_participant = {
						is_alive = no
					}
				}
				desc = childhood.7500.participant_dead
			}
			desc = childhood.7500.no_participant
		}
		desc = childhood.7500.midpoint
		random_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:family
				}
				desc = childhood.7500.family
			}
			triggered_desc = {
				trigger = {
					exists = scope:martial
				}
				desc = childhood.7500.martial
			}
			triggered_desc = {
				trigger = {
					exists = scope:death
				}
				desc = childhood.7500.death
			}
			triggered_desc = {
				trigger = {
					exists = scope:war
				}
				desc = childhood.7500.war
			}
			triggered_desc = {
				trigger = {
					exists = scope:relationships
				}
				desc = childhood.7500.relationships
			}
			triggered_desc = {
				trigger = {
					exists = scope:childhood
				}
				desc = childhood.7500.childhood
			}
		}
	}

	theme = memory_positive
	override_background = { reference = bp1_bonfire }
	
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { 
				exists = scope:death
			}
  			animation = shock
  		}
		triggered_animation = {
			trigger = { 
				exists = scope:war
			}
  			animation = worry
  		}
		triggered_animation = {
			trigger = { 
				exists = scope:family
			}
  			animation = personality_rational
  		}
		triggered_animation = {
			trigger = { 
				exists = scope:martial
			}
  			animation = personality_honorable
  		}
		triggered_animation = {
			trigger = { 
				exists = scope:relationships
			}
  			animation = boredom
  		}
		triggered_animation = {
			trigger = { 
				exists = scope:childhood
			}
  			animation = happiness
  		}
	}
	right_portrait = {
		character = scope:guardian
		animation = throne_room_conversation_2
	}
	
	lower_right_portrait = scope:memory_participant
	
	cooldown = { years = 10 }

	trigger = {
		exists = house
		exists = location
		is_available_adult = yes
		culture = {
			has_cultural_parameter = tells_stories
		}
		OR = {
			any_relation = {
				type = friend
				is_available_adult = yes
				NOT = {
					has_relation_rival = root
				}
				any_memory = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = childhood
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
			}
			any_relation = {
				type = lover
				is_available_adult = yes
				NOT = {
					has_relation_rival = root
				}
				any_memory = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = childhood
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
			}
			any_close_family_member = {
				location = root.location
				is_available_adult = yes
				NOT = {
					has_relation_rival = root
				}
				any_memory = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = childhood
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
			}
			any_spouse = {
				location = root.location
				is_available_adult = yes
				NOT = {
					has_relation_rival = root
				}
				any_memory = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = childhood
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
			}
		}
	}

	immediate = {
		every_relation = {
			type = friend
			limit = {
				is_available_adult = yes
				NOT = {
					has_relation_rival = root
				}
				any_memory = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = childhood
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
			}
			add_to_list = story_candidates
		}
		every_relation = {
			type = lover
			limit = {
				is_available_adult = yes
				NOT = {
					has_relation_rival = root
				}
				any_memory = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = childhood
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
			}
			add_to_list = story_candidates
		}
		every_close_family_member = {
			limit = {
				location = root.location
				is_available_adult = yes
				NOT = {
					has_relation_rival = root
				}
				any_memory = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = childhood
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
			}
			add_to_list = story_candidates
		}
		every_spouse = {
			limit = {
				location = root.location
				is_available_adult = yes
				NOT = {
					has_relation_rival = root
				}
				any_memory = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = childhood
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
			}
			add_to_list = story_candidates
		}
		
		random_in_list = {
			list = story_candidates
			weight = {
				base = 1
				modifier = {
					add = 20
					has_relation_friend = root
				}
				modifier = {
					add = 10
					is_of_major_interest_to_root_trigger = yes
				}
				modifier = {
					add = 5
					is_of_minor_interest_to_root_trigger = yes
				}
			}
			assign_quirk_effect = yes
			save_scope_as = guardian
		}
		scope:guardian = {
			random_memory = {
				limit = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = childhood
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
				save_scope_as = guardian_memory
				if = {
					limit = {
						has_memory_category = family
					}
					save_scope_as = family
				}
				if = {
					limit = {
						has_memory_category = martial
					}
					save_scope_as = martial
				}
				if = {
					limit = {
						has_memory_category = death
					}
					save_scope_as = death
				}
				if = {
					limit = {
						has_memory_category = war
					}
					save_scope_as = war
				}
				if = {
					limit = {
						has_memory_category = relationships
					}
					save_scope_as = relationships
				}
				if = {
					limit = {
						has_memory_category = childhood
					}
					save_scope_as = childhood
				}
				if = {
					limit = {
						any_memory_participant = {
							exists = this
							NOT = { this = scope:guardian }
						}
					}
					random_memory_participant = {
						limit = {
							NOT = { this = scope:guardian }
						}
						save_scope_as = memory_participant
					}
				}
			}
		}
	}

	option = { # haha what a story mark
		name = childhood.7500.a
		send_interface_toast = {
			type = event_toast_effect_good
			title = skill_increased
			left_icon = root
			random_list = {
				10 = {
					trigger = { exists = scope:family }
					add_diplomacy_skill = 1
				}
				10 = {
					trigger = { exists = scope:martial }
					add_prowess_skill = 1
				}
				10 = {
					trigger = { exists = scope:death }
					add_intrigue_skill = 1
				}
				10 = {
					trigger = { exists = scope:war }
					add_martial_skill = 1
				}
				10 = {
					trigger = { exists = scope:relationships }
					add_stewardship_skill = 1
				}
				10 = {
					trigger = { exists = scope:childhood }
					add_learning_skill = 1
				}
			}
		}
		
		stress_impact = {
			lazy = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = lazy
			}
		}
	}

	option = { # zzz
		name = culture_tradition_events.2100.b
		
		progress_towards_friend_effect = {
			REASON = friend_story
			CHARACTER = scope:guardian
			OPINION = 0
		}
		
		stress_impact = {
			base = minor_stress_impact_loss
			lazy = medium_stress_impact_loss
			diligent = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				NOT = {
					has_trait = lazy
				}
			}
		}
	}
}
